const mysql = require('mysql')
const {
    createConnection
} = require('net')


const connection = mysql.createConnection({
    host: 'localHost',
    user: 'root',
    password: 'a945271134',
    database: 'luminous'
})
const query = {
    name:'韩信',
    content:'哈哈哈哈哈'
}
connection.connect()

const sql = 'insert into message_copy(name,content) values(?,?)'

connection.query(sql,[query.name,query.content] ,function (error, result) {
    console.log(result)
    connection.end()



    // console.log(error);
    // console.log(result)
    // if (error) {
    //     console.log('输出有误')
    //     console.log(error)
    // } else {
    //     result.forEach(element => {
    //         console.log(element.id, element.name, element.content)
    //     });
    // }
})